// 创建路由实例 绑定path element

import Layout from "@/pages/Layout";
import New from "@/pages/New";
// import Month from "@/pages/Month";
// import Year from "@/pages/Year";
import { createBrowserRouter } from "react-router-dom";
import { lazy, Suspense } from "react";

const Month = lazy(() => import('@/pages/Month'))
const Year = lazy(() => import('@/pages/Year'))

const router = createBrowserRouter([
    {
        path: "/",
        element: <Layout />,
        children: [
            {
                index: true,
                element: <Suspense fallback={'加载中'}><Month /></Suspense>
            },
            {
                path: 'year',
                element: <Suspense fallback={'加载中'}><Year /></Suspense>
            },
        ]
    },
    {
        path: "/new",
        element: <New />
    }
])

export default router